package com.zhanghe.im.console;

import com.zhanghe.im.request.MessageRequestPacket;
import io.netty.channel.Channel;

import java.util.Scanner;

public class SendToUserConsoleCommand implements ConsoleCommand {

    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.println("请输入需要发送给哪个用户:");
        String toUserId = scanner.next();
        System.out.println("请输入需要发送的消息:");
        String message = scanner.next();
        MessageRequestPacket packet = new MessageRequestPacket();
        packet.setToUserId(toUserId);
        packet.setMessage(message);
        channel.writeAndFlush(packet);
    }
}
